<?php
/**
 * Joomla! 1.5 component JoomGPSTracks
 *
 * @version $Id: default.php 2009-06-24 15:40:19 svn $
 * @author Michael Pfister
 * @package joomGPStracks
 * @subpackage backend
 * @license GNU/GPL
 * @filesource
 *
 */

defined('_JEXEC') or die('Restricted access');

// toolbar
JToolBarHelper::title(JText::_('GPS_CATS'), 'categories.png');
JToolBarHelper::back($alt= 'Back', $href= 'javascript:history.back();');
JToolBarHelper::spacer();
JToolBarHelper::addNew('newcat', 'New', 'new.png' );
JToolBarHelper::publish();
JToolBarHelper::unpublish();
JToolBarHelper::deleteList();
$ordering = ($this->lists['order'] == 'ordering');


	?>
    <form action="index.php" method="post" name="adminForm">

    <table class="adminlist" cellpadding="1">
        <thead>
            <tr>
                <th width="5%" class="title"><?php echo JText::_( 'NUM' ); ?></th>
                <th width="5%" class="title">
                    <input type="checkbox" name="toggle" value="" onclick="checkAll(<?php echo count($this->rows); ?>);" />
                </th>
                <th width="60%" class="title"><?php echo JText::_( 'GPS_CAT' ); ?></th>
        		<th width="8%" class="order">
                    <?php echo JText::_('Order'); ?>
                    <?php if ($ordering) echo JHTML::_('grid.order',  $this->rows ); ?>
                </th>
                <th width="21%" class="title"><?php echo JText::_( 'State'); ?></th>
                <th width="1%" class="title" nowrap="nowrap">
					<?php echo JText::_( 'ID'); ?>
				</th>
			</tr>
         </thead>
         <tbody>
         <?php
	$k = 0;
	for ($i=0, $n=count( $this->list ); $i < $n; $i++)
	{
		$row = &$this->list[$i];

		$link 	= JRoute::_( 'index.php?option=com_joomgpstracks&task=editcat&controller=cats&id='. $row->id );

		$checked 	= JHTML::_('grid.checkedout',   $row, $i );
		$published 	= JHTML::_('grid.published', $row, $i );

             ?>
             <tr class="<?php echo "row$k"; ?>">
                <td align="center"><?php echo $this->pagination->getRowOffset( $i ); ?></td>
                <td align="center"><?php echo $checked; ?></td>
                <td align="left"><a href="<?php echo $link; ?>"><?php echo $row->treename.$row->title; ?></a></td>
                <td class="order">
                <span><?php echo $this->pagination->orderUpIcon( $i, true,'orderup', 'Move Up', $ordering ); ?></span>
				<span><?php echo $this->pagination->orderDownIcon( $i, $n, true, 'orderdown', 'Move Down', $ordering ); ?></span>
				<?php $disabled = $ordering ?  '' : 'disabled="disabled"'; ?>
				<input type="text" name="order[]" size="5" value="<?php echo $row->ordering;?>" <?php echo $disabled ?> class="text_area" style="text-align: center" />
                </td>
                <td align="center"><?php echo $published;?></td>
                <td><?php echo $row->id; ?></td>
             </tr>
             <?php
             $k = 1 - $k;
         }
         ?>
         </tbody>
    </table>
    <input type="hidden" name="option" value="com_joomgpstracks" />
    <input type="hidden" name="task" value="cats" />
	<input type="hidden" name="boxchecked" value="0" />
    <input type="hidden" name="controller" value="cats" />
	<input type="hidden" name="filter_order" value="<?php echo $this->lists['order']; ?>" />
	<input type="hidden" name="filter_order_Dir" value="<?php echo $this->lists['order_Dir']; ?>" />
    <?php echo JHTML::_( 'form.token' ); ?>
    </form>

